package cn.keniykey.mc.landterritory.database;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public abstract class AbDataBase {
	public abstract Connection getConnection();
	public abstract void update(String sql,Object...objs);
	public abstract void excute(String sql,Object...objs) throws SQLException;
	public abstract ResultSet query(String sql,Object...objs) throws SQLException;
	public abstract void fush();
	protected abstract void close();
	@Override
	public abstract String toString();
	
	static void setParameters(PreparedStatement ps,Object[] objs) throws SQLException {
		for(int index = 0; index < objs.length; index++) ps.setObject((index+1), objs[index]);
	}
}